<!--
 * @Description  : 
 * @Author       : zhao
 * @Date         : 2022-07-11 09:16:55
 * @LastEditors  : zhao
 * @LastEditTime : 2022-08-02 18:10:29
-->
<template>
	<div class="system-user-container">
		<zTable :searchType="searchType" :tableHeader="tableHeader" :tableData="tableData" :title="'借阅用户'" />
		<AddUer ref="addUserRef" />
		<EditUser ref="editUserRef" />
	</div>
</template>

<script lang="ts">
import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import AddUer from '/@/views/system/user/component/addUser.vue';
import zTable from '/@/components/zTable/index.vue';
import EditUser from '/@/views/system/user/component/editUser.vue';
import usdata from "./user.ts"
import { useTableInfo } from '/@/stores/ztable'

export default defineComponent({
	name: 'systemUser',
	components: { AddUer, EditUser, zTable },
	setup() {
		const addUserRef = ref();
		const editUserRef = ref();

		const searchType = ref(usdata.searchType);
		const tableHeader = ref(usdata.tableHeader);
		const tableData = ref(usdata.tableData);
		// 初始化表格数据
		const initTableData = async () => {
			// const data: Array<TableDataRow> = [];

			let useTableInfos = useTableInfo()
			useTableInfos.$reset()
			let { zTable, zTableType, getTableData, zTableFunction } = useTableInfo()
			// const Finishdata = await getUserInfom()
			useTableInfos.zTable.routerUrl = "/system/webUser/details"
			useTableInfos.zTableType.border = false
			useTableInfos.zTableType.menu = false
			useTableInfos.zTable.mdName.name = "useUserInfo"
			useTableInfos.zTable.mdName.url = "getUserInfo"
			await useTableInfos.getTableData()
		};

		// 页面加载时
		initTableData();
		onMounted(() => {
		});
		return {
			addUserRef,
			editUserRef,

			searchType,
			tableHeader,
			tableData
		};
	},
});
</script>
